package ccnGame;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.IOException;

import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.JPanel;
import javax.swing.JRadioButton;

import org.ccnx.ccn.config.ConfigurationException;
import org.ccnx.ccn.protocol.MalformedContentNameStringException;

public class SelectGame extends JFrame{
	
	private JPanel pane;
	private JButton startbutton;
	private JRadioButton Btn1;
	private JRadioButton Btn2;
	private JRadioButton Btn3;
		
	public int end=-1;
	
	public SelectGame(String space1, String nickname1){
		
		
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 150);
		Container content = getContentPane();
		pane = new JPanel();
		startbutton = new JButton("Select");
		Btn1 = new JRadioButton("BaseBall");
		Btn2 = new JRadioButton("UP&DOWN");
		Btn3 = new JRadioButton("WordChain");
		ButtonGroup bg = new ButtonGroup();
		
		Btn1.setSelected(true);
		bg.add(Btn1);
		bg.add(Btn2);
		bg.add(Btn3);
		pane.add(Btn1);
		pane.add(Btn2);
		pane.add(Btn3);
		pane.add(startbutton, BorderLayout.SOUTH);
		content.add(pane);
		
		startbutton.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent e1){
				if(Btn1.isSelected()){
					end=1;
				}else if(Btn2.isSelected()){
					end=2;
				}else{
					end=3;
				}
				
			}
		});
		
		
	}
/*
	@Override
	public void actionPerformed(ActionEvent arg0) {
		// TODO Auto-generated method stub
		this.setVisible(false);
		if(Btn1.isSelected()){
			end=1;
		}else if(Btn2.isSelected()){
			end=2;
		}else{
			end=3;
		}
	}*/
}